package cn.kgc.util.desensitization;

import com.fasterxml.jackson.annotation.JacksonAnnotationsInside;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * @author wangyue
 * @version 1.0
 * 用来指定哪些属性进行数据脱敏
 */
@JacksonAnnotationsInside
@JsonSerialize(using = SensitiveInfoSerializer.class)
@Target({ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
@SuppressWarnings("all")
public @interface Desensitization {
    /**
     * 脱敏数据类型
     */
    DesensitizationType type();

    /**
     * 被脱敏的数据前面有多少位不被*号遮盖
     * 130********
     */
    int prefixLen() default 0;

    /**
     * 被脱敏的数据后面有多少位不被*号遮盖
     * 130*******1
     */
    int suffixLen() default 0;
}